NotificationManagerCompat

Compatibility library for NotificationManager with fallbacks for older platforms.

To use this class, call the static function from to get a NotificationManagerCompat object, and then call one of its methods to post or cancel notifications.

Types

Link copied to clipboard
Link copied to clipboard
Helper class which encapsulates a Notification, its id, and optionally a tag, for use when batch-posting a number of notifications.

Properties

Link copied to clipboard
val ACTION_BIND_SIDE_CHANNEL: String = "android.support.BIND_NOTIFICATION_SIDE_CHANNEL"
Intent action to register for on a service to receive side channel notifications.
Link copied to clipboard
val EXTRA_USE_SIDE_CHANNEL: String = "android.support.useSideChannel"
Notification extras key: if set to true, the posted notification should use the side channel for delivery instead of using notification manager.
Link copied to clipboard
Default notification importance: shows everywhere, allowed to makes noise, but does not visually intrude.
Link copied to clipboard
Higher notification importance: shows everywhere, allowed to makes noise and peek.
Link copied to clipboard
Low notification importance: shows everywhere, but is not intrusive.
Link copied to clipboard
Highest notification importance: shows everywhere, allowed to makes noise, peek, and use full screen intents.
Link copied to clipboard
Min notification importance: only shows in the shade, below the fold.
Link copied to clipboard
A notification with no importance: shows nowhere, is blocked.
Link copied to clipboard
Value signifying that the user has not expressed an importance.
Link copied to clipboard
Interruption filter constant - Alarms only interruption filter - all notifications except those of category CATEGORY_ALARM are suppressed.
Link copied to clipboard
Interruption filter constant - Normal interruption filter - no notifications are suppressed.
Link copied to clipboard
Interruption filter constant - No interruptions filter - all notifications are suppressed and all audio streams (except those used for phone calls) and vibrations are muted.
Link copied to clipboard
Interruption filter constant - Priority interruption filter - all notifications are suppressed except those that match the priority criteria.
Link copied to clipboard
Interruption filter constant - returned when the value is unavailable for any reason.

Functions

Link copied to clipboard
Returns whether notifications from the calling package are not blocked.
Link copied to clipboard
open fun cancel(id: Int)
open fun cancel(@Nullable tag: String, id: Int)
Cancel a previously shown notification.
Link copied to clipboard
open fun cancelAll()
Cancel all previously shown notifications.
Link copied to clipboard
Returns whether the calling app can send fullscreen intents.
Link copied to clipboard
Creates a notification channel that notifications can be posted to.
Link copied to clipboard
Creates multiple notification channel groups.
Link copied to clipboard
Creates multiple notification channel groups.
Link copied to clipboard
Creates multiple notification channels that different notifications can be posted to.
Link copied to clipboard
Creates multiple notification channels that different notifications can be posted to.
Link copied to clipboard
Deletes the given notification channel.
Link copied to clipboard
Deletes the given notification channel group, and all notification channels that belong to it.
Link copied to clipboard
Deletes notification channels for which ids are NOT given.
Link copied to clipboard
Get a NotificationManagerCompat instance for a provided context.
Link copied to clipboard
Recover a list of active notifications: ones that have been posted by the calling app that have not yet been dismissed by the user or canceled by the app.
Link copied to clipboard
Gets the current notification interruption filter.
Link copied to clipboard
Get the set of packages that have an enabled notification listener component within them.
Link copied to clipboard
open fun getImportance(): Int
Returns the user specified importance for notifications from the calling package.
Link copied to clipboard
Returns the notification channel settings for a given channel id.
Returns the notification channel settings for a given channel and conversation id.
Link copied to clipboard
Returns the notification channel settings for a given channel id.
Returns the notification channel settings for a given channel and conversation id.
Link copied to clipboard
Returns the notification channel group settings for a given channel group id.
Link copied to clipboard
Returns the notification channel group settings for a given channel group id.
Link copied to clipboard
Returns all notification channel groups belonging to the calling app or an empty list on older SDKs which don't support Notification Channels.
Link copied to clipboard
Returns all notification channel groups belonging to the calling app or an empty list on older SDKs which don't support Notification Channels.
Link copied to clipboard
Returns all notification channels belonging to the calling app or an empty list on older SDKs which don't support Notification Channels.
Link copied to clipboard
Returns all notification channels belonging to the calling app or an empty list on older SDKs which don't support Notification Channels.
Link copied to clipboard
Post a number of notifications, to be shown in the status bar, stream, etc.
Post a notification to be shown in the status bar, stream, etc.